package com.dcd.controller;

import com.dcd.annotation.MultiRequestBody;
import com.dcd.pojo.Collection_video;
import com.dcd.service.Collection_videoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@CrossOrigin
@RequestMapping("/collection_videoController")
public class Collection_videoController {

    @Autowired
    private Collection_videoService cvs;

    /**
     * 根据登入用户id查询所有视频集合
     * @param user_id 登入用户id
     * @return
     */
    @RequestMapping("/select_collection_videoList_byId/{user_id}")
    public List<Collection_video> select_collection_videoList_byId(@PathVariable Integer user_id){
          return cvs.select_collection_videoList_byId(user_id);
    }

    /**
     * 根据type类型来判断进行添加或者删除
     * @param collection_video 收藏视频表对象
     * @param type 类型
     * @return
     */
    @RequestMapping("/insert_or_delete_collection_video")
    public String insert_or_delete_collection_video(@MultiRequestBody Collection_video collection_video, @MultiRequestBody String type){
        return cvs.insert_or_delete_collection_video(collection_video,type);
    }

    /**
     * 查询登录id 是否收藏了该视频   视频播放页
     * @param collection_video 收藏表对象
     * @return
     */
    @RequestMapping("/select_voider_broadcast")
    public String select_voider_broadcast(@MultiRequestBody Collection_video collection_video){
        return cvs.select_voider_broadcast(collection_video);
    }
}
